import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:online_study/base/app_title.dart';
import 'package:online_study/home/message/message_details.dart';
import 'package:online_study/theme/colors.dart';
import 'package:online_study/theme/size.dart';

//消息列表
class MessageListPage extends StatefulWidget {
  @override
  _MessageListPageState createState() => _MessageListPageState();
}

class _MessageListPageState extends State<MessageListPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: BackButton(color: ThemeColor.color333333),
        titleSpacing: 0,
        backgroundColor: ThemeColor.colorWhite,
        elevation: ThemeSize.appElevation,
        title: AppTitle("消息列表"),
      ),
      body: Container(
        color: ThemeColor.colorWhite,
        child: ListView.separated(
            itemBuilder: (BuildContext context, int index) {
              return GestureDetector(
                behavior: HitTestBehavior.opaque,
                child: Container(
                  width: double.infinity,
                  height: ThemeSize.height58,
                  child: Row(
                    children: [
                      Container(
                        width: ThemeSize.width24,
                        alignment: Alignment.center,
                        child: Icon(Icons.circle,
                            size: ThemeSize.width8, color: ThemeColor.colorRed),
                      ),
                      Expanded(
                          child: Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text("企业文化全员考核",
                                  style: TextStyle(
                                      color: ThemeColor.color333333,
                                      fontSize: ThemeSize.sp13)),
                              Container(
                                padding: EdgeInsets.only(top: ThemeSize.height10),
                                child: Text("2021-03-24 16：46",
                                    style: TextStyle(
                                        color: ThemeColor.color808080,
                                        fontSize: ThemeSize.sp10)),
                              ),
                            ],
                          ))
                    ],
                  ),
                ),
                onTap: () {
                  Get.to(() => MessageDetailsPage());
                },
              );
            },
            separatorBuilder: (BuildContext context, int index) {
              return Divider(height: ThemeSize.width1);
            },
            itemCount: 8,
            shrinkWrap: true),
      ),
    );
  }
}
